﻿using System;
using System.Collections.Generic;
using System.Text;

using System.Runtime.InteropServices;

namespace BadApplePlayer
{
    public class Win32
    {
        [DllImport("user32.dll")]
        public static extern IntPtr WindowFromPoint(POINT pt);
        [DllImport("user32.dll")]
        public static extern bool GetWindowRect(IntPtr hWnd, out LPRECT lpRect);
        [DllImport("user32.dll")]
        public static extern bool ScreenToClient(IntPtr hWnd, out POINT lpPt);
        [DllImport("user32.dll")]
        public static extern IntPtr FindWindowEx(IntPtr hWndParent, IntPtr hWndChildAfter, string lpszClass, string lpszWindow);
        [DllImport("user32.dll")]
        public static extern IntPtr GetDC(IntPtr hWnd);
        [DllImport("gdi32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);

        public const int SRCCOPY = 0xCC0020;

        public struct POINT
        {
            public int X;
            public int Y;
        }

        public struct LPRECT
        {
            public int Left;
            public int Top;
            public int Right;
            public int Bottom;
            public int Width {
                get { return Right - Left; }
            }
            public int Height {
                get { return Bottom - Top; }
            }
            public System.Drawing.Rectangle ToRectangle() {
                return new System.Drawing.Rectangle(Left, Top, Right - Left, Bottom - Top);
            }
        }
    }
}
